<template>
  <div class="detail-logistics">
    <p>
      <span>{{ progressInfo[0].time }}</span>
      <span>{{ progressInfo[0].context }}</span>
    </p>
    <a @click="orderExpress(order)" href="javascript:;">查看物流</a>
    <Teleport to="#orderExpress">
      <OrderExpress ref="orderExpressCom"></OrderExpress>
    </Teleport>
  </div>
</template>
<script>
import OrderExpress from './order-express.vue'
import { useOrderExpress } from '../index.vue'
// 导入物流数据(模拟数据)
import express from './express'
export default {
  name: 'DetailLogistics',
  components: { OrderExpress },
  props: {
    order: {
      type: Object,
      default: () => ({})
    }
  },
  setup() {
    // 物流数据
    const progressInfo = express.data
    // 给最后一条物流信息加一个标识颜色
    progressInfo[0].color = '#0bbd87'
    return { ...useOrderExpress(), progressInfo }
  }
}
</script>
<style scoped lang="less">
.detail-logistics {
  height: 50px;
  display: flex;
  align-items: center;
  padding: 0 30px;
  background-color: #f5f5f5;
  margin: 30px 50px 0;

  >p {
    flex: 1;

    span {
      color: #999;

      &:first-child {
        margin-right: 30px;
      }
    }
  }

  >a {
    color: @xtxColor;
    text-align: center;
  }
}
</style>